package cn.newtest.bi.collection.dao.hibernate;


import java.util.List;

import net.risesoft.risebi.collection.dao.CatalogObjectTreeDao;
import net.risesoft.risebi.collection.model.StatisticalObjectTree;
import net.risesoft.risebi.collection.model.StatisticalObjectTreeNode;

import org.appfuse.dao.hibernate.BaseDaoHibernate;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
*	
*	
* @author <a href="mailto: wangchui@risesoft.net">王锤</a>
* @version $Revision$
* 
*/
@Repository(value = "catalogObjectTreeDao")
public class CatalogObjectTreeDaoImpl extends BaseDaoHibernate implements CatalogObjectTreeDao {
	@Autowired
	public CatalogObjectTreeDaoImpl(SessionFactory sessionFactory) {
		super();
		setSessionFactory(sessionFactory);
	}
	
	public List<StatisticalObjectTree> getAllOrderByTabIndex() throws Exception {
		String hql = "from StatisticalObjectTree order by tabIndex";
		this.getHibernateTemplate().setCacheQueries(true);
		List<StatisticalObjectTree> list = this.getHibernateTemplate().find(hql);
		return list;
	}
	
	public List<StatisticalObjectTreeNode> getAllNodeOrderByTabIndex() throws Exception {
		String hql = "from StatisticalObjectTreeNode order by tabIndex";
		this.getHibernateTemplate().setCacheQueries(true);
		List<StatisticalObjectTreeNode> list = this.getHibernateTemplate().find(hql);
		return list;
	}
}
